<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8">
		<title></title>
		<style type="text/css">
			
			/* #div1{
				width: 100%;
				height: 100px;
				border: solid 3px #FFFF00;
			} */
		</style>
	</head>
	<body>
		<button type="button" onclick="b1();">获取网易新闻</button>
		<button type="button" onclick="b2();">一个集新闻，图片，文章，句子的接口</button>
		<button type="button" onclick="b3();">获取唐朝古诗词</button>
		<button type="button" onclick="b4();">美图推荐</button>
		<button type="button" onclick="b5();">开发者登陆</button>
		<div id="div1">
			
		</div>
	</body>
	<script type="text/javascript">
		 var div1 = document.getElementById('div1');
		 function b1(){
			 var xhr =new XMLHttpRequest();
			 xhr.open('POST','https://api.apiopen.top/getWangYiNews');
			 xhr.setRequestHeader('Content-Type','application/x-www-form-urlencoded');
			 xhr.send('page=1&count=5');
			 xhr.onreadystatechange = function(){
				 if (xhr.readyState == 4) {
				 	if (xhr.status>=200 && xhr.status<300) {
				 		div1.innerHTML =xhr.responseText;
				 	}
				 }
			 }
		 }
		 function b2(){
		 	 var xhr =new XMLHttpRequest();
		 	 xhr.open('POST','http://meiriyikan.cn/api/json.php');
		 	 xhr.setRequestHeader('Content-Type','application/x-www-form-urlencoded');
		 	 xhr.send(null);
		 	 xhr.onreadystatechange = function(){
		 	 	 if (xhr.readyState == 4) {
		 	 	 	if (xhr.status>=200 && xhr.status<300) {
		 	 	 		div1.innerHTML =xhr.responseText;
		 	 	 	}
		 	 	 }
		 	 }
		 }
		 function b3(){
		 			 var xhr =new XMLHttpRequest();
		 			 xhr.open('POST','https://api.apiopen.top/getTangPoetry');
		 			 xhr.setRequestHeader('Content-Type','application/x-www-form-urlencoded');
		 			 xhr.send('page=1&count=5');
		 			 xhr.onreadystatechange = function(){
		 			 				 if (xhr.readyState == 4) {
		 			 				 	if (xhr.status>=200 && xhr.status<300) {
		 			 				 		div1.innerHTML =xhr.responseText;
		 			 				 	}
		 			 				 }
		 			 }
		 }
		 function b4(){
		 			 var xhr =new XMLHttpRequest();
		 			 xhr.open('POST','https://api.apiopen.top/getImages');
		 			 xhr.setRequestHeader('Content-Type','application/x-www-form-urlencoded');
		 			 xhr.send('page=1&count=5');
		 			 xhr.onreadystatechange = function(){
		 				 if (xhr.readyState == 4) {
		 				 	if (xhr.status>=200 && xhr.status<300) {
		 				 		div1.innerHTML =xhr.responseText;
		 				 	}
		 				 }
		 			 }
		 }
		 function b5(){
		 			 var xhr =new XMLHttpRequest();
		 			 xhr.open('POST','https://api.apiopen.top/developerLogin');
		 			 xhr.setRequestHeader('Content-Type','application/x-www-form-urlencoded');
		 			 xhr.send('name=peakchao&passwd=123456');
		 			 xhr.onreadystatechange = function(){
		 				 if (xhr.readyState == 4) {
		 				 	if (xhr.status>=200 && xhr.status<300) {
		 				 		div1.innerHTML =xhr.responseText;
		 				 	}
		 				 }
		 			 }
		 }
	</script>
</html>
